fix: /receive now handles login from another location#211
Conversation
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Disabled knowledge base sources:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR refines LINE SSE authentication-failure handling: error classification now recognizes ChangesSSE Auth-Failure Handling
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/connector/sync.go`:
- Around line 1279-1294: Add a nil guard for lc.UserLogin before dereferencing
it in the recoverToken error path inside the poll-loop logic. In the branch that
logs “Failed to recover session, stopping poll loop” and sends BridgeState
updates, first check lc.UserLogin != nil (or return early if it is nil),
matching the defensive pattern used by markLoggedOutByOtherClient in client.go.
Keep the existing errRecover handling, but make the logger and BridgeState
access conditional on a valid UserLogin to avoid a panic when recoverToken fails
while the client has no UserLogin.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e15fda62-23e7-4d48-9014-fd4e7f843f3c
📒 Files selected for processing (7)
pkg/connector/client.gopkg/connector/sync.gopkg/connector/sync_test.gopkg/line/errors.gopkg/line/errors_test.gopkg/line/sse.gopkg/line/sse_test.go
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
- GitHub Check: build-docker
- GitHub Check: Lint with 1.25
- GitHub Check: build-docker
- GitHub Check: Lint with 1.25
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Usego fmtfor code formatting across all Go files
Usegoimportswith-local "github.com/highesttt/matrix-line-messenger"flag to group project-local imports correctly
Usezerologfor logging throughout the codebase
Do not useMsgfin logging; useMsgwith structured fields instead
UseStringerinterface where applicable in Go code
Files:
pkg/line/sse.gopkg/line/errors_test.gopkg/line/errors.gopkg/line/sse_test.gopkg/connector/sync.gopkg/connector/client.gopkg/connector/sync_test.go
**/!(ltsm)/**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/!(ltsm)/**/*.go: Runstaticcheckon all Go files excludingpkg/ltsmpackage (transpiled WASM code)
Rungo veton all Go files excludingpkg/ltsmpackage (transpiled WASM code)
Files:
pkg/line/sse.gopkg/line/errors_test.gopkg/line/errors.gopkg/line/sse_test.gopkg/connector/sync.gopkg/connector/client.gopkg/connector/sync_test.go
🔇 Additional comments (10)
pkg/line/errors.go (2)
27-34: LGTM!
47-56: 🎯 Functional CorrectnessFragile substring matching for the JSON
codefield; prefer the shared helper or a regex-based check.pkg/line/errors_test.go (1)
57-59: LGTM!pkg/line/sse.go (2)
7-7: LGTM!Also applies to: 18-19
50-56: 🔒 Security & Privacy | ⚡ Quick winConfirm upstream error bodies won't leak sensitive data into logs.
The raw (trimmed) response body is now embedded directly into the returned error, which later flows into
.Err(err).Msg("SSE Disconnected")inpollLoop. If LINE's error envelope ever echoes back tokens or other account-identifying data on auth failures, that content would end up in application logs. The 4096-byte cap limits volume but not content.Consider stripping/redacting known sensitive substrings (e.g., tokens) before including the body, or confirm LINE's error payloads for this endpoint are limited to generic error codes/messages.
pkg/connector/sync.go (2)
1250-1254: LGTM!
1261-1278: LGTM!Also applies to: 1295-1297
pkg/connector/sync_test.go (1)
5-5: LGTM!Also applies to: 65-115, 117-140
pkg/connector/client.go (1)
290-303: LGTM!pkg/line/sse_test.go (1)
11-39: 🎯 Functional CorrectnessCheck
roundTripFuncis available inpkg/lineThis test depends on
roundTripFunc; if it isn’t defined in anotherpkg/linehelper, the test won’t compile.
No description provided.